package com.example.nbb.Service;

import com.example.nbb.Dao.SortDao;
import com.example.nbb.Entity.ResultEntity;
import jakarta.annotation.Resource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

@Service
public class SortService {
    private static final Logger logger = LoggerFactory.getLogger(SortService.class);//日志   getLogger需要传入当前的类名

    @Resource
    SortDao sortDao;

    /**
     * 获取所有的分类信息
     * @return 返回
     */
    public String getSort() {
        try {
            return ResultEntity.success(sortDao.getAll());
        } catch (Exception e) {
            e.printStackTrace();
            logger.error(e.getLocalizedMessage());
            return ResultEntity.fail(-10004);
        }
    }
}
